"""django_vu URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, re_path, include
from rest_framework.routers import DefaultRouter
from web.views import user, group, document

router = DefaultRouter()
router.register('document', document.DocumentViewSet)
# 这里相当于这样写了之后会自己生成两条路由path和re_path...，里面有5个方法的对应关系，比如post:create,
urlpatterns = [
    # path('admin/', admin.site.urls),
    path('', include(router.urls)),
    path('api/login/', user.login),
    path('api/logout/', user.logout),
    re_path('api/user/(?P<id>[\w-]+)', user.UserDetail.as_view()),
    path('api/user/', user.UserView.as_view()),
    path('api/get_user/', user.get_user),
    path('api/group/', group.GroupView.as_view(), name="group"),
    path('api/mygroup/', group.mygroup),
    path('api/group_created_byme/', group.group_created_by_me),
    path('api/groupiscreatedbyme/', group.groupiscreatedbyme),
    path('api/searchgroup/', group.search_group),
    path('api/addgroupmember/', group.addgroupmember),
    path('api/refuse_groupmember/',group.refuse_groupmember),
    path('api/queryuser/', group.queryuser),
    path('api/invite_user/', group.invite_user),
    path('api/apply_in_group/', group.apply_in_group),
    path('api/accept_application_addgroupmember/', group.accept_application_addgroupmember),
    path('api/refuse_application_addgroupmember/', group.refuse_application_addgroupmember),
    path('api/get_user_bygroup/', group.get_user_bygroup),
    path('api/quit_group/', group.quit_group),
    path('api/delete_group/', group.delete_group),

    path('api/my_docs/', document.my_docs),
    path('api/my_deleted_docs/', document.my_delete_docs),
    path('api/tell_doc_right/', document.tell_doc_right),
    path('api/tell_current_doc_right/', document.tell_current_doc_right),
    path('api/get_doccontent/', document.get_doccontent),
    path('api/create_personal_doc/', document.create_personal_doc),
    path('api/create_group_doc/', document.create_group_doc),
]
